CREATE VIEW [dbo].[vSoaGroupSummary]
AS
SELECT [GroupId],
[ParentEntityTypeName],
[ParentEntityId],
[GroupClassId],
[Name],
NULL AS [Description],
CAST(0 AS BIT) AS [IsSimpleGroup],
CAST(0 AS BIT) AS [IsMemberGroup],
CAST(0 AS BIT) AS [IsPrimaryGroup]
FROM [dbo].[vSoaGroupSummaryProduct]
UNION ALL
SELECT [GroupId],
[ParentEntityTypeName],
[ParentEntityId],
[GroupClassId],
[Name],
NULL AS [Description],
CAST(1 AS BIT) AS [IsSimpleGroup],
CAST(0 AS BIT) AS [IsMemberGroup],
CAST(0 AS BIT) AS [IsPrimaryGroup]
FROM [dbo].[vSoaGroupSummaryMeeting]
UNION ALL
SELECT [GroupId],
[ParentEntityTypeName],
[ParentEntityId],
[GroupClassId],
[Name],
[Description],
CAST(1 AS BIT) AS [IsSimpleGroup],
[IsMemberGroup],
CAST(1 AS BIT) AS [IsPrimaryGroup]
FROM [dbo].[vSoaGroupSummaryMT]
UNION ALL
SELECT [GroupId],
[ParentEntityTypeName],
[ParentEntityId],
[GroupClassId],
[Name],
CAST('Relationships' AS VARCHAR(6000)) AS [Description],
CAST(0 AS BIT) AS [IsSimpleGroup],
CAST(0 AS BIT) AS [IsMemberGroup],
CAST(0 AS BIT) AS [IsPrimaryGroup]
FROM [dbo].[vSoaGroupSummaryRelationship]
UNION ALL
SELECT [GroupId],
[ParentEntityTypeName],
[ParentEntityId],
[GroupClassId],
[Name],
CAST('Organizational Relationship' AS VARCHAR(6000)) AS [Description],
CAST(0 AS BIT) AS [IsSimpleGroup],
CAST(0 AS BIT) AS [IsMemberGroup],
CAST(0 AS BIT) AS [IsPrimaryGroup]
FROM [dbo].[vSoaGroupSummaryOrganization]
GO